<template>
  <div class="tmall-search-input">
    <div class="search-bar">
      <input
        v-model="searchQuery"
        @input="handleInput"
        @keyup.enter="performSearch"
		@click="search"
        class="search-input"
        placeholder="搜索商品名称"
      />
      <button @click="performSearch" class="search-button">
        <i class="iconfont icon-search">搜索</i>
      </button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchQuery: "", // 用户输入的搜索关键词
    };
  },
  methods: {
    handleInput() {
		
      // 响应输入事件
    },
    performSearch() {
      // 执行搜索操作，使用 this.searchQuery
      if (this.searchQuery.trim() !== "") {
		  
        console.log("执行搜索操作:", this.searchQuery);
        // 在这里执行实际的搜索操作，比如调用 API 或更新视图
      }
    },
	search(){
		uni.navigateTo({
			url: '/pages/product/search'
		});
	}
  },
};
</script>

<style scoped>
.tmall-search-input {
  background-color: #fff;
  padding: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: #f5f5f5;
  border-radius: 15px;
  padding: 0px;
  height: 50px;
}

.search-input {
  flex: 1;
  padding: 10px;
  border: none;
  background-color: transparent;
  font-size: 14px;
}

.search-button {
  background-color: #ff6b00;
  border: none;
  color: #fff;
  padding: 10px 15px;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  height: 50px;
  line-height: 25px;
}
</style>
